<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<!-- Set render engine for 360 browser -->
	<meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- HTML5 shim for IE8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <![endif]-->

	<link href="/public/simpleboot/themes/<?php echo C('SP_ADMIN_STYLE');?>/theme.min.css" rel="stylesheet">
    <link href="/public/simpleboot/css/simplebootadmin.css" rel="stylesheet">
    <link href="/public/js/artDialog/skins/default.css" rel="stylesheet" />
    <link href="/public/simpleboot/font-awesome/4.4.0/css/font-awesome.min.css"  rel="stylesheet" type="text/css">
    <style>
		.length_3{width: 180px;}
		form .input-order{margin-bottom: 0px;padding:3px;width:40px;}
		.table-actions{margin-top: 5px; margin-bottom: 5px;padding:0px;}
		.table-list{margin-bottom: 0px;}
	</style>
	<!--[if IE 7]>
	<link rel="stylesheet" href="/public/simpleboot/font-awesome/4.4.0/css/font-awesome-ie7.min.css">
	<![endif]-->
<script type="text/javascript">
//全局变量
var GV = {
    DIMAUB: "/",
    JS_ROOT: "public/js/",
    TOKEN: ""
};
document.domain = "xinhuiwen.com";
</script>
<!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="/public/js/jquery.js"></script>
    <script src="/public/js/wind.js"></script>
    <script src="/public/js/publish.js"></script>

    <script src="/public/simpleboot/bootstrap/js/bootstrap.min.js"></script>
<?php if(APP_DEBUG): ?><style>
		#think_page_trace_open{
			z-index:9999;
		}
	</style><?php endif; ?>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="<?php echo U('Admin/Area/index');?>">地区列表</a></li>
    </ul>
    <form class="well form-search" id="query_form" method="post" action="<?php echo U('Admin/News/index');?>">
        地区名称：
        <input type="text" name="areaName" style="width: 120px;" value="<?php echo ($formParam["areaName"]); ?>" placeholder="地区名称...">
        <input type="button" name="query_form_btn" id="queryBtn" data-action="<?php echo U('Admin/Area/index');?>"  class="btn btn-primary" value="查询"/>
        <a href='<?php echo U("Admin/Area/areaAdd");?>' class="btn btn-primary" >开通地区</a>
        <br/><br/>
        
    </form>
    <form class="js-ajax-form" action="" method="post">
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
                <th>索引</th>
                <th>城市名称</th>
                <th width="900">管理员</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <?php $tmp_key = 0;?>
            <?php if(is_array($data)): foreach($data as $key=>$vo): ?><tr>
                	<?php
 if($old_initial !=$vo['initial']){ ?>
                    <td rowspan="<?php echo $count_data[$tmp_key]?>"><?php echo ($vo['initial']); ?></td>
                    <?php
 $old_initial = $vo['initial']; $tmp_key++; } ?>
                    <td><?php echo ($vo['name']); ?></td>
                    <td style="word-wrap:break-word;word-break:break-all;"><?php echo ($vo['administrator_str']); ?><a style="float:right;"  class="btn btn-primary"  onclick="edit_admin(<?php echo ($vo["area_id"]); ?>)">修改</a></td>
                    <td>
                        <?php if($vo["disable_status"] ==1 ): ?><a href='<?php echo U("Admin/Area/open",array("id"=>$vo["area_id"])) ;?>'
                                   class="js-ajax-dialog-btn text-success">启用</a>
                                <?php else: ?>
                                <a href='<?php echo U("Admin/Area/close",array("id"=>$vo["area_id"])) ;?>'
                                   class="js-ajax-dialog-btn text-error">禁用</a><?php endif; ?>
                        <a href='<?php echo U("Admin/Area/del",array("areaId"=>$vo["area_id"]));?>' class="js-ajax-dialog-btn"
                           data-msg="确定要删除此地区吗？">删除</a>
                        <a href="<?php echo U('News/index',array('area_id'=>$vo['area_id']));?>" >进入新闻列表</a>
                        <a onclick="edit_liverole('<?php echo ($vo["area_id"]); ?>','<?php echo ($vo["live_status"]); ?>')" style="margin-left: 25px;">直播权限设置</a>
                    </td>
                </tr><?php endforeach; endif; ?>
            </tbody>
        </table>
    </form>
    <div class="pagination"><?php echo ($page); ?></div>
</div>
<script src="/public/js/common.js"></script>
<script src="/public/js/layer/layer.js"></script>
<script>
    $(document).ready(function () {
        $('input[name="query_form_btn"]').click(function () {
            $('#query_form').attr('action', $(this).attr('data-action'));
            $('#query_form').submit();
        });
    });
    
 function edit_admin(area_id){
	  layer.open({
  	    type: 2,
  	    //skin: 'layui-layer-lan',
  	    title: '修改地区管理员',
  	    fix: false,
  	    shadeClose: true,
  	    maxmin: true,
  	    area: ['1000px', '500px'],
  	    content: "<?php echo U('Admin/Area/editAdmin')?>"+'&area_id='+area_id,
  	    end: function(){
  	    	location.reload();
  	    }
  	  });
 }
    function edit_liverole(area_id,live_status){
        layer.open({
            type: 2,
            //skin: 'layui-layer-lan',
            title: '修改地区管理员',
            fix: false,
            shadeClose: true,
            maxmin: true,
            area: ['1000px', '500px'],
            content: "<?php echo U('Admin/Area/editliverole')?>"+'&area_id='+area_id+'&live_status='+live_status,
            end: function(){
                location.reload();
            }
        });
    }
</script>
</body>
</html>